var t = getApp();

Component({
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        },
        page_id: {
            type: null
        },
        index: {
            type: null
        },
        U_tabcontrol: {
            type: null
        },
        bottomShowBolIndex: {
            type: null
        },
        plugin_active: {
            type: null
        },
        store_alone_temp: {
            type: null
        },
        store_id: {
            type: null
        }
    },
    data: {
        emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",
        clientWidth: "375",
        language: "",
        list: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    lifetimes: {
        attached: function() {
            var t = wx.getStorageSync("langIndex");
            this.setData({
                language: t.en
            });
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        Number(this.data.datas.get_number) > 0 && 2 != this.data.datas.get_style ? this.getData(this.data.datas.list) : this.setData({
            isLoadMore: !1
        }), this.setData({
            clientWidth: wx.getSystemInfoSync().windowWidth
        });
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        getData: function(t) {
            this.setData({
                page: 1,
                isLoadMore: !0,
                total_page: t.last_page
            }), this.data.total_page <= 1 && this.setData({
                isLoadMore: !1
            }), t.data.length > this.data.datas.get_number && (t.data.splice(this.data.datas.get_number, t.data.length - this.data.datas.get_number), 
            this.setData({
                isLoadMore: !1
            })), this.setData({
                list: t.data
            });
        },
        getMoreData: function() {
            var a = this, e = this;
            if (e.setData({
                isLoadMore: !1
            }), !(e.data.page >= e.data.total_page)) {
                e.setData({
                    page: e.data.page + 1
                });
                var s = t.getNetAddresss("home-page.get-decorate-page");
                this.properties.store_id && (s += "&store_id=".concat(this.properties.store_id)), 
                s += "&page=" + e.data.page, s += "&decorate_id=" + e.data.page_id, s += "&component_id=" + e.data.component_id, 
                this.data.U_tabcontrol ? (s += "&component_key=U_tabcontrol", s += "&component_info=" + JSON.stringify({
                    list_key: this.data.index
                })) : s += "&component_key=U_shortvideo", t._getNetWork({
                    url: s,
                    success: function(t) {
                        var s = t.data;
                        if (1 == s.result) {
                            var o = [];
                            o = a.data.U_tabcontrol ? e.data.list.concat(s.data[0].remote_data.list.data) : e.data.list.concat(s.data.data), 
                            e.data.page < e.data.total_page && e.setData({
                                isLoadMore: !0
                            }), o.length > a.data.datas.get_number && (o.splice(a.data.datas.get_number, o.length - a.data.datas.get_number), 
                            a.setData({
                                isLoadMore: !1
                            })), a.setData({
                                list: o
                            });
                        } else e.setData({
                            page: e.data.page - 1,
                            isLoadMore: !1
                        });
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            }
        },
        loadMoreMemberData: function() {
            var a = this, e = this;
            if (e.setData({
                isLoadMore: !1
            }), !(e.data.page >= e.data.total_page)) {
                e.setData({
                    page: e.data.page + 1
                });
                var s = t.getNetAddresss("plugin.video-share.frontend.video.getList");
                1 == this.data.store_alone_temp && (s = t.getNetAddresss("plugin.store-alone-temp.frontend.member.nav-data"), 
                s += "&code=" + e.data.plugin_active), s += "&page=" + e.data.page, t._getNetWork({
                    url: s,
                    success: function(t) {
                        var s = t.data;
                        if (1 == s.result) {
                            var o = [];
                            o = e.data.list.concat(s.data.list.data), e.data.page < e.data.total_page && e.setData({
                                isLoadMore: !0
                            }), o.length > a.data.datas.get_number && (o.splice(a.data.datas.get_number, o.length - a.data.datas.get_number), 
                            a.setData({
                                isLoadMore: !1
                            })), e.triggerEvent("setLoadMore", {
                                isLoadMore: e.data.isLoadMore
                            }), a.setData({
                                list: o
                            });
                        } else e.setData({
                            page: e.data.page - 1,
                            isLoadMore: !1
                        });
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            }
        }
    }
});